<div class="al-modal-view">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" ng-click="cancel()">
      <span aria-hidden="true" class="glyphicon glyphicon-remove"></span>
      <span class="sr-only">Close</span>
    </button>
    <h4 class="modal-title ok-color">{{modalTitle}}</h4>
  </div>
  <div class="modal-body">
    <table ng-table="modalTableParams" style="margin-bottom:20px;"
           class="table table-td-center table-bordered table-striped table-condensed al-table-container">
      <thead>
      <tr>
        <td>序号</td>
        <td>名称</td>
        <td>类型</td>
        <td>数量</td>
        <td>价格</td>
        <td>排序</td>
        <td ng-if="type!='view'">操作</td>
      </tr>
      </thead>
      <tbody>
      <tr class="table-no-data" ng-if="$data.length==0">
        <td colspan="{{type=='view'?6:7}}">没有数据</td>
      </tr>
      <tr ng-repeat="item in $data">
        <td>{{$index+1}}</td>
        <td>{{item.name}}</td>
        <td>{{item.type|constantTransfer:configureTypeList:'code'}}</td>
        <td>{{item.quantity}}</td>
        <td>{{item.price}}</td>
        <td>{{item.sorting}}</td>
        <td ng-if="type!='view'">
          <button class="btn btn-sm btn-danger" ng-click="removeDevice(item)">移除</button>
        </td>
      </tr>
      </tbody>
    </table>
    <ng-form name="modalForm" class="form-horizontal form-validation" role="form">
      <div class="form-group">
        <label class="col-sm-3 col-sm-offset-1 control-label">名称<span class="attr-need">*</span></label>
        <div class="col-sm-6">
          <input type="text" class="form-control" ng-model="new.name" required>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-3 col-sm-offset-1 control-label">类型</label>
        <div class="col-sm-6">
          <select ng-model="new.type" class="form-control" ng-if="configureTypeList"
                  ng-options="option.code as option.name for option in configureTypeList"></select>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-3 col-sm-offset-1 control-label">数量<span class="attr-need">*</span></label>
        <div class="col-sm-6">
          <input type="number" class="form-control" ng-model="new.quantity"
                 ng-pattern="$root.sortVd"
                 required>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-3 col-sm-offset-1 control-label">价格<span class="attr-need">*</span></label>
        <div class="col-sm-6">
          <input type="text" class="form-control" ng-model="new.price" required>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-3 col-sm-offset-1 control-label">排序<span class="attr-need">*</span></label>
        <div class="col-sm-6">
          <input type="number" class="form-control" ng-pattern="$root.sortVd" required
                 ng-model="new.sorting">
        </div>
      </div>
      <div class="form-group">
        <div class="col-sm-12 text-center">
          <button class="btn-success btn"  ng-disabled="new.quantity<=0 || new.sorting<=0"
                  ng-click="addDevice()">添加</button>
        </div>
      </div>
    </ng-form>
  </div>
  <div class="modal-footer">
    <button class="btn btn-warning no-border" type="button" ng-click="cancel()">关闭</button>
    <!--<button class="btn btn-primary no-border" type="button" ng-click="confirm()" ng-disabled="modalForm.$invalid">确定</button>-->
  </div>
</div>